# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: James Spencer <james.s.spencer@gmail.com>

pkgbase=jmol
pkgname=(jmol
         jsmol)
pkgver=16.1.47
pkgrel=1
arch=(any)
url='https://jmol.sourceforge.net'
license=(LGPL)
makedepends=(unzip)
source=(https://sourceforge.net/projects/jmol/files/Jmol/Version%20${pkgver%.*}/Jmol%20$pkgver/Jmol-$pkgver-binary.zip)
sha256sums=('235fead82dbbc80226e7e2ba3fcece37cb265410c807a7b72b9e28c98f455bb5')

package_jmol() {
  pkgdesc='A Java 3D viewer for chemical structures'
  depends=(java-runtime)

  cd $pkgbase-$pkgver

  mkdir -p "$pkgdir"/usr/share/$pkgname
  mkdir -p "$pkgdir"/usr/bin

  cp *.jar "$pkgdir"/usr/share/$pkgname
  install -Dm755 jmol.sh "$pkgdir"/usr/share/$pkgname
  ln -s /usr/share/$pkgname/$pkgname.sh "$pkgdir"/usr/bin/$pkgname
}

package_jsmol() {
  pkgdesc='A JavaScript 3D viewer for chemical structures'
  cd $pkgbase-$pkgver

  mkdir -p "$pkgdir"/usr/share
  unzip jsmol.zip -d "$pkgdir"/usr/share/
}
